<?php 
// 留言详情页面
include 'comm.php';
if(!isset($_SESSION['user'])){
    show_msg("请先登录！","login.php");
}
$id=$_GET['id'];
$sql="select * from lyb_info where lyb_id='$id'";
$res=$conn->query($sql);
$row=$res->fetch_assoc();
if(isset($_POST['submit'])){
    rpl_public($id,$_POST['rplcontent']);
}
$sql_rpl="select * from lyb_rpl where lyb_id='$id'";
$res_rpl=$conn->query($sql_rpl);
$row_rpl=$res_rpl->num_rows;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML>
<HEAD>
<TITLE>留言详情</TITLE>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<STYLE type=text/css>BODY {
	MARGIN: 0px
}
</STYLE>
<LINK href="css/css.css" type=text/css rel=stylesheet>
<STYLE type=text/css>.STYLE1 {
	FONT-FAMILY: "宋体"
}
</STYLE>
<script type="text/javascript">
function check(){
	if(rplform.rplcontent.value==""){
		alert("回复内容不能为空！！");
		return false;
	}
	return true;
}
</script>
<META content="MSHTML 6.00.2900.6003" name=GENERATOR>
</HEAD>
<BODY>
<TABLE cellSpacing=0 cellPadding=0 width=760 align=center border=0>
  <TBODY>
  <TR>
    <TD
    style="BORDER-RIGHT: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid; BORDER-BOTTOM: #c0c0c0 1px solid"
    vAlign=top width=140 bgColor=#eeeeee>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD class=left_bg2><A class=link3
            href="register.php">用户注册</A></TD></TR>
        <TR>
          <TD class=left_bg2><A class=link3
            href="login.php">用户登录</A></TD></TR>
        <TR>
        <TR>
          <TD class=left_bg2><A class=link3
            href="view.php">查看留言</A></TD></TR>
        <TR>
          <TD class=left_bg2><A class=link3
            href="lyb.php">在线留言</A></TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD></TD></TR></TBODY></TABLE></TD>
    <TD vAlign=top width=8></TD>
    <TD vAlign=top>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD class=bt>查看留言</TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=10 width="100%" border=0>
        <TBODY>
        <TR>
          <TD height=350>
            <TABLE cellSpacing=1 cellPadding=6 width="100%" bgColor=#ff9900
            border=0>
              <TBODY>
              <TR>
                <TD
                bgColor=#fff2e6>您可以在此处查看用户留言的详细信息并发表回复。</TD></TR></TBODY></TABLE><BR>
        	<TABLE borderColor=#111111 cellSpacing=0 cellPadding=4 width="100%" bgColor=#ffffff border=0>
              <?php 
                echo "<tr align=center><td colspan=2><h2>".$row['title']."</h2></td></tr>";
                echo "<tr><td width=100>【留言类型：";
                switch ($row['ly_type']) {
                    case 1:
                        echo "求助";
                        break;
                        
                    case 2:
                        echo "建议";
                        break;
                        
                    case 3:
                        echo "投诉";
                        break;
                        
                    case 4:
                        echo "表扬";
                        break;
                    case 5:
                        echo "业务联系";
                        break;
                }
                echo "】</td><td width=100>【留言时间：".$row['ly_time']."】</td></tr>";
                echo "<tr><td colspan=2>".$row['content']."</td></tr>";
                echo "<tr align=right><td colspan=2>【作者：".$row['author']."】</td></tr>";
                echo "<tr><td colspan=2><hr/></td></tr>";
                while ($row_rpl=$res_rpl->fetch_assoc()) {
                    echo "<tr><td colspan=2>".$row_rpl['rpl_cont']."</td></tr>";
                    echo "<tr><td width=240>回复时间：".$row_rpl['rpl_time']."</td><td>回复人：".$row_rpl['rpl_author']."</td></tr>";
                    echo "<tr><td colspan=2><hr/></td></tr>";
                }
              ?>
              </TBODY>
              <form action="" method="post" id="rplform" onsubmit="return check()">
              <TBODY>
              <TR>
                <TD vAlign=bottom noWrap colSpan=2></TD></TR>
              <TR>
                <TD vAlign=bottom width=55>回复内容：</TD>
                <TD vAlign=bottom><textarea rows="10" cols="30" name="rplcontent"></textarea> </TD></TR>
              <TR>
                <TD>
  				<input type="submit" name="submit" value="回复"/>
  				<input type="reset" name="reset" value="重置"/>
                </TD></TR>
          </TBODY></form></TABLE></TD></TR></TBODY></TABLE>
</BODY>   
</HTML>
